<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>评论页</title>
    <script src="./http1.js"></script>
    <style>
        .commentlist{
            border-bottom: 1px solid #999;
        }
        .commentlist p:first-child{
            display: flex;
            align-items: center;
            height: 50px;
        }
        .commentlist p:first-child img{
            margin-right: 20px;
            height: 100%;
        }
        
    </style>
</head>
<body>
    <h2></h2>
    <script>
        let id=sessionStorage.getItem('id');
        let songname=sessionStorage.getItem('songname');
        document.querySelector("h2").textContent=songname+"(精彩评论)";
        let obj={
            type:0,
            id:id
        }
        http.get('https://autumnfish.cn/comment/hot',obj,function(res){
            console.log(JSON.parse(res));
            let res1=JSON.parse(res).hotComments;
            let comments="";
            res1.forEach(function(item){
                comments+=`
                    <div class="commentlist">
                        <p><img src="${item.user.avatarUrl}"><span>${item.user.nickname}</span></p>
                        <p>${item.content}</p>
                    </div>
                `
            })
            document.body.innerHTML+=comments;
        })
    </script>
</body>
</html>